<template>
  <div>
    <div class="banner" @click="handleBanner">
      <img class="banner-img" :src="bannerImg" alt="">
      <div class="banner-info">
        <div class="banner-title">{{sightName}}</div>
        <div class="banner-icon">
          <i class="iconfont">&#xe617;</i>
          <i>{{gallaryImgs.length}}</i>
        </div>
      </div>
    </div>
    <Fade>
      <gallery v-if="ShowGallery" :imgList="gallaryImgs" @close="handleCloseGallery"></gallery>
    </Fade>
  </div>
</template>

<script>
import Gallery from '@/common/gallery/gallery'
import Fade from '@/common/Animation/fade'
export default {
  name: 'DetailBanner',
  props: ['sightName', 'bannerImg', 'gallaryImgs'],
  data () {
    return {
      ShowGallery: false
    }
  },
  components: {
    Gallery,
    Fade
  },
  methods: {
    handleBanner () {
      this.ShowGallery = true
    },
    handleCloseGallery () {
      this.ShowGallery = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    position: relative
    overflow: hidden
    height: 0
    padding-bottom: 55%
    .banner-img
      width: 100%
    .banner-info
      display: flex
      position: absolute
      bottom: 0
      right: 0
      left: 0
      line-height: .6rem
      color: #fff
      background: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, .8))
      .banner-title
        flex: 1
        font-size: .32rem
        padding: 0 .2rem
      .banner-icon
        padding: 0 .2rem
        margin: .1rem .1rem 0 0;
        line-height: .4rem
        height: .4rem
        border-radius: .15rem
        background: rgba(0, 0, 0, .8)
</style>
